#!/usr/bin/env Rscript
# This file sets the parameters for BRS for the simulation study

## Run below if not running files in a single session to load data created in
## sim_make-data.R; otherwise can skip
if ( TRUE ) {
  # Load simulation data
  load("sim/out/simData.rda")
  load("sim/out/simIndices.rda")
  
  # simulation parameters 
  numVar <- c(5, 10, 20) # Number of variables
  popN <- 100000 # Population size = 100k; note that an earlier draft of this paper erroneously stated that the population size was 1mil
  sampleSize <- c(25, 100, 250, 500, 750, 1000) # Sample sizes
  numSims <- 100 # Number of simulations
  pppn <- list("deterministic" = c(1,0),  # P(y=1 | x \in A)=1 and P(y=1 | x \notin A)=0; i.e., y=1 if and only if x satisfies the rule set
               "probabilistic" = c(.75, .25))  # P(y=1 | x \in A)=.75 and P(y=1 | x \notin A)=.25
}


## Parameters for BRS ------------------
numMine = 5000L      # number of rules to be used in SA_patternbased and also the output of generate_rules
Niteration = 2000L  # number of iterations in each chain
Nchain = 5L         # number of chains in the simulated annealing search algorithm
supp = 5L           # minimum support of a rule
maxLen = 3L         # maxmum length of a rule
a1 <- 500e2L  # alpha_+
b1 <- 1e2L  # beta_+
a2 <- 500e2L  # alpha_-
b2 <- 1e2L  # beta_-
train_prop = 1

## Seeds for each simulation of BRS ------------------
set.seed(123)
seeds <- list()
for (i in 1:6) {
  seeds[[i]] <- lapply(sampleSize, function(x) sample.int(1e5, size=numSims))
}

# Function for getting eta for BRS-Poisson ------------------
getEta <- function(x) {
  return(1/(x/10)^5)
}